using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Toon.Models.Characters;

namespace Toon.Models.Tests.Characters
{
    
	public partial class CharacterTests
	{

		Dictionary<string, object> GetValues(Toon.Models.Characters.Character objectUnderTest)
		{
			
			var result = new Dictionary<string, object>();
			result["Catalog"] = objectUnderTest.Catalog;
			result["Name"] = objectUnderTest.Name;
			result["Rules"] = objectUnderTest.Rules;
			result["Species"] = objectUnderTest.Species;
			result["Occupation"] = objectUnderTest.Occupation;
			result["NaturalEnemies"] = objectUnderTest.NaturalEnemies;
			result["BeliefsAndGoals"] = objectUnderTest.BeliefsAndGoals;
			result["Description"] = objectUnderTest.Description;
			result["Possessions"] = objectUnderTest.Possessions;
			result["Attributes"] = objectUnderTest.Attributes;
			result["Shitcks"] = objectUnderTest.Shitcks;
			result["HitPoints"] = objectUnderTest.HitPoints;
			result["MaxSkillPoints"] = objectUnderTest.MaxSkillPoints;
			result["SkillPointsSpent"] = objectUnderTest.SkillPointsSpent;
			result["UnspentSkillPoints"] = objectUnderTest.UnspentSkillPoints;
			result["Speed"] = objectUnderTest.Speed;
			result["Random"] = objectUnderTest.Random;
			result["IsChanged"] = objectUnderTest.IsChanged;
			result["HasErrors"] = objectUnderTest.HasErrors;
			return result;
		}

		List<string> GetDiffs(Dictionary<string, object> originalValues, Toon.Models.Characters.Character objectUnderTest)
		{
			return GetDiffs(originalValues, GetValues(objectUnderTest));
		}

		List<string> GetDiffs(Dictionary<string, object> originalValues, Dictionary<string, object> newValues)
		{
			var result = new List<string>();
			foreach(var item in originalValues)
			{
				if (!Object.Equals(item.Value, newValues[item.Key]))
					result.Add(item.Key);
			}

			return result;
		}

		public Toon.Models.Characters.Character GetObject(int version)
		{
			var objectUnderTest = CreateObject();
			SetValues(objectUnderTest, version);
			return objectUnderTest;
		}

		public void SetValues(Toon.Models.Characters.Character objectUnderTest, int version)
		{
			
			Helper_Set_Name(objectUnderTest, version);
			Helper_Set_Species(objectUnderTest, version);
			Helper_Set_Occupation(objectUnderTest, version);
			Helper_Set_NaturalEnemies(objectUnderTest, version);
			Helper_Set_BeliefsAndGoals(objectUnderTest, version);
			Helper_Set_Description(objectUnderTest, version);
			Helper_Set_HitPoints(objectUnderTest, version);
		}

        
		//implement this to provide a custom list of known good values
		partial void Helper_SetOverride_Name(Toon.Models.Characters.Character objectUnderTest, int version, ref bool wasSet);

        void Helper_Set_Name (Toon.Models.Characters.Character objectUnderTest, int version)
        {
			var wasSet = false;
			Helper_SetOverride_Name(objectUnderTest, version, ref wasSet);
			if (wasSet)
				return;

			var successCount = 0;
        
            
            try
            {
                objectUnderTest.Name = null;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "1";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "x";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = ",";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "123";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "abc";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "1,2,3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "a,b,c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "1;2;3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "a;b;c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "http://test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Name = "test@test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
        
			if (successCount == 0)
				Assert.Inconclusive("Could not complete test, unable to set the property."); 			
			else
				Helper_Set_Name(objectUnderTest, version-successCount);
        }    
        
        
		//implement this to provide a custom list of known good values
		partial void Helper_SetOverride_Species(Toon.Models.Characters.Character objectUnderTest, int version, ref bool wasSet);

        void Helper_Set_Species (Toon.Models.Characters.Character objectUnderTest, int version)
        {
			var wasSet = false;
			Helper_SetOverride_Species(objectUnderTest, version, ref wasSet);
			if (wasSet)
				return;

			var successCount = 0;
        
            
            try
            {
                objectUnderTest.Species = null;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "1";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "x";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = ",";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "123";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "abc";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "1,2,3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "a,b,c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "1;2;3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "a;b;c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "http://test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Species = "test@test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
        
			if (successCount == 0)
				Assert.Inconclusive("Could not complete test, unable to set the property."); 			
			else
				Helper_Set_Species(objectUnderTest, version-successCount);
        }    
        
        
		//implement this to provide a custom list of known good values
		partial void Helper_SetOverride_Occupation(Toon.Models.Characters.Character objectUnderTest, int version, ref bool wasSet);

        void Helper_Set_Occupation (Toon.Models.Characters.Character objectUnderTest, int version)
        {
			var wasSet = false;
			Helper_SetOverride_Occupation(objectUnderTest, version, ref wasSet);
			if (wasSet)
				return;

			var successCount = 0;
        
            
            try
            {
                objectUnderTest.Occupation = null;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "1";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "x";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = ",";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "123";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "abc";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "1,2,3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "a,b,c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "1;2;3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "a;b;c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "http://test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Occupation = "test@test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
        
			if (successCount == 0)
				Assert.Inconclusive("Could not complete test, unable to set the property."); 			
			else
				Helper_Set_Occupation(objectUnderTest, version-successCount);
        }    
        
        
		//implement this to provide a custom list of known good values
		partial void Helper_SetOverride_NaturalEnemies(Toon.Models.Characters.Character objectUnderTest, int version, ref bool wasSet);

        void Helper_Set_NaturalEnemies (Toon.Models.Characters.Character objectUnderTest, int version)
        {
			var wasSet = false;
			Helper_SetOverride_NaturalEnemies(objectUnderTest, version, ref wasSet);
			if (wasSet)
				return;

			var successCount = 0;
        
            
            try
            {
                objectUnderTest.NaturalEnemies = null;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "1";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "x";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = ",";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "123";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "abc";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "1,2,3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "a,b,c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "1;2;3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "a;b;c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "http://test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.NaturalEnemies = "test@test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
        
			if (successCount == 0)
				Assert.Inconclusive("Could not complete test, unable to set the property."); 			
			else
				Helper_Set_NaturalEnemies(objectUnderTest, version-successCount);
        }    
        
        
		//implement this to provide a custom list of known good values
		partial void Helper_SetOverride_BeliefsAndGoals(Toon.Models.Characters.Character objectUnderTest, int version, ref bool wasSet);

        void Helper_Set_BeliefsAndGoals (Toon.Models.Characters.Character objectUnderTest, int version)
        {
			var wasSet = false;
			Helper_SetOverride_BeliefsAndGoals(objectUnderTest, version, ref wasSet);
			if (wasSet)
				return;

			var successCount = 0;
        
            
            try
            {
                objectUnderTest.BeliefsAndGoals = null;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "1";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "x";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = ",";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "123";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "abc";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "1,2,3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "a,b,c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "1;2;3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "a;b;c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "http://test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.BeliefsAndGoals = "test@test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
        
			if (successCount == 0)
				Assert.Inconclusive("Could not complete test, unable to set the property."); 			
			else
				Helper_Set_BeliefsAndGoals(objectUnderTest, version-successCount);
        }    
        
        
		//implement this to provide a custom list of known good values
		partial void Helper_SetOverride_Description(Toon.Models.Characters.Character objectUnderTest, int version, ref bool wasSet);

        void Helper_Set_Description (Toon.Models.Characters.Character objectUnderTest, int version)
        {
			var wasSet = false;
			Helper_SetOverride_Description(objectUnderTest, version, ref wasSet);
			if (wasSet)
				return;

			var successCount = 0;
        
            
            try
            {
                objectUnderTest.Description = null;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "1";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "x";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = ",";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "123";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "abc";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "1,2,3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "a,b,c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "1;2;3";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "a;b;c";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "http://test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.Description = "test@test.com";
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
        
			if (successCount == 0)
				Assert.Inconclusive("Could not complete test, unable to set the property."); 			
			else
				Helper_Set_Description(objectUnderTest, version-successCount);
        }    
        
        
		//implement this to provide a custom list of known good values
		partial void Helper_SetOverride_HitPoints(Toon.Models.Characters.Character objectUnderTest, int version, ref bool wasSet);

        void Helper_Set_HitPoints (Toon.Models.Characters.Character objectUnderTest, int version)
        {
			var wasSet = false;
			Helper_SetOverride_HitPoints(objectUnderTest, version, ref wasSet);
			if (wasSet)
				return;

			var successCount = 0;
        
            
            try
            {
                objectUnderTest.HitPoints = Int32.MinValue;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.HitPoints = (System.Int32)(-1);
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.HitPoints = (System.Int32)0;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.HitPoints = (System.Int32)1;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
            
            try
            {
                objectUnderTest.HitPoints = Int32.MaxValue;
                successCount += 1;
				if (successCount == version)
					return;
            }
            catch (ArgumentException)
            {
                //Try the next value
            }
            
        
			if (successCount == 0)
				Assert.Inconclusive("Could not complete test, unable to set the property."); 			
			else
				Helper_Set_HitPoints(objectUnderTest, version-successCount);
        }    
        


	}
}
